/**
 * jgamebox
 *
 * outlook@China software studio
 * Copyright (c) 2008-2011. All Rights Reserved.
 * http://www.outlook.com
 */

package org.outlook.common.measure;

/**
 * function:
 * 
 * @author watson email: watson.wu@hotmail.com
 * @date 2011-5-29
 */
public class Volume implements Cloneable {

	int weight;
	int height;
	int thick;

	public Volume() {
		this(0,0,0);
	}

	public Volume(int weight, int height, int thick) {
		super();
		this.weight = weight;
		this.height = height;
		this.thick = thick;
	}

	public int getWeight() {
		return weight;
	}

	public void setWeight(int weight) {
		this.weight = weight;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public int getThick() {
		return thick;
	}

	public void setThick(int thick) {
		this.thick = thick;
	}

	public void combine(Volume volume) {
		setWeight(getWeight()+volume.getWeight());
		setHeight(getHeight()+volume.getHeight());
		setThick(getThick()+volume.getThick());
	}

	public static Volume combine(Volume vol1, Volume vol2) {
		Volume clone = (Volume) vol1.clone();
		clone.setWeight(clone.getWeight()+vol2.getWeight());
		clone.setHeight(clone.getHeight()+vol2.getHeight());
		clone.setThick(clone.getThick()+vol2.getThick());
		return clone;
	}

	@Override
	protected Object clone() {
		try {
			return super.clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public String toString() {
		return new StringBuilder().append("Volume[").append(getWeight()).append(",").append(getHeight()).append(",").append(getThick()).append("]").toString();
	}

}
